##############################################################################
# Filename: Robustness_ControlGroup.R
# Purpose: Produce SI Table A7 
##############################################################################

source("Setup.R")

### Models 1-5: Article evaluation results with full sample

data_eval2 = data_op

# Set neutral values for those in treatment groups who didn't write a comment
data_eval2$CommentBiased[is.na(data_eval2$CommentBiased)&data_eval2$Article%in%c("DN","DP")] <- 0
data_eval2$CommentFeeling[is.na(data_eval2$CommentFeeling)&data_eval2$Article%in%c("DN","DP")] <- 2

# Incorporate comments-based dependent variables for road safety placebo article
data_eval2$CommentBiased = ifelse(data_eval2$Article=="pl", data_eval2$Coder4_Biased, data_eval2$CommentBiased)
data_eval2$CommentFeeling = ifelse(data_eval2$Article=="pl", data_eval2$Coder4_Feeling, data_eval2$CommentFeeling)
data_eval2$CommentBiased[is.na(data_eval2$CommentBiased)&data_eval2$Article%in%c("pl")] <- 0
data_eval2$CommentFeeling[is.na(data_eval2$CommentFeeling)&data_eval2$Article%in%c("pl")] <- 2

# Models 
mod_correct_2 = lm(YesCorrect ~ ProBJP*Article + CollegeGrad + NewsDaily + StrongInterestPolitics, data = data_eval2)
mod_ww_2 = lm(YesWellWritten ~ ProBJP*Article + CollegeGrad + NewsDaily + StrongInterestPolitics, data = data_eval2)
mod_recm_2 = lm(YesRecommend ~ ProBJP*Article + CollegeGrad + NewsDaily + StrongInterestPolitics, data = data_eval2)
mod_bias_2 = lm(CommentBiased ~ ProBJP*Article + CollegeGrad + NewsDaily + StrongInterestPolitics, data = data_eval2)
mod_feel_2 = lm(as.numeric(CommentFeeling) ~ ProBJP*Article + CollegeGrad + NewsDaily + StrongInterestPolitics,
                  data = data_eval2)


### Model 6: Demonetization opinion results with treated sample only
mod_dem_tmtonly = lm(as.numeric(op_dem) ~ ProBJP*Article
                     + CollegeGrad
                     + NewsDaily + StrongInterestPolitics,
                     data = data_eval)


### Print table
stargazer(mod_correct_2, mod_ww_2, mod_recm_2, 
          mod_bias_2, mod_feel_2, 
          mod_dem_tmtonly,
          align=TRUE,
          covariate.labels=c("Pro-BJP", "Negative Article", "Positive Article",
                             "College Graduate", "Daily News",  "Interested in Politics",
                             "Pro-BJP x Negative Article", "Pro-BJP x Positive Article"),
          omit.stat=c("LL","ser","f"), no.space=TRUE)